﻿using System;
using FL.Entity.DB;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;

namespace FL.Test
{
    [TestClass]
    public class DalTest
    {
        [TestMethod]
        public void TestMethod1()
        {
        }

        private Fuliu_TestEntities entity1 = new Fuliu_TestEntities();
        [TestMethod]
        public void TestSetMainsVsersion()
        {
            CustomerOrder order = new CustomerOrder();
            CustomerOrder_include _order = new CustomerOrder_include();
            
            var jsonStr =JsonConvert.SerializeObject(order.Edit(1128367, ""));
            _order.SetMainsVersion(1128367, "", "HYZ20161200521", jsonStr, 4, "ACD0C76F-0AD4-4DF6-BE18-0FF318D2186A", 2);
        }

        [TestMethod]
        public void TestGetData()
        {
            FL.Bussiness.BaseBussnies bll = new Bussiness.BaseBussnies();
            System.Data.DataTable dt = bll.GetDataBySqlComm(@"SELECT [empno]
                  ,[lastname]
                  ,[photoimg]
              FROM [t_hr_emp]");
            foreach ( System.Data.DataRow row in dt.Rows)
            {
                try
                {
                    byte[] o = (byte[])row.ItemArray[2];
                    object no = "F_" + row.ItemArray[0].ToString().Replace("*", "n");
                    FL.Common.FileHelper.WriteBuffToFile(o, "E:\\temp\\" + no + ".jpg", ".jpg", true);
                }catch(Exception e){};

            }
            
        }
    }
}
